/**
 * Created by zhx on 2016/12/29.
 */
import DateTool from './DateTool.js';
class TypeTool {
  // 特效文字格式化
  static filmDimensionalMix(value) {
    if (/^\d+$/.test(value)) {
      return '暂无特效信息'
    } else {
      return value.replace(/\$\$/g, ',');
    }
  }

  static platformChineseFromLatin(latin) {
    let chinese = {
      'taobao':'淘票票',
      'wangpiao': '网票网',
      'spider': '蜘蛛网',
      'maizuo': '卖座网',
      'danche': '单车网',
      'baidu': '百度糯米',
      'meituan': '美团',
      'dazhong': '大众点评',
      'maoyan': '猫眼'
    }[latin];
    return chinese;
  }

  static isAfterToday(showDate) {
    if (showDate === '') {
      return '购票';
    }
    if (showDate) {
      let today = DateTool.formatDateToString((new Date()), 'yyyy-MM-dd');
      let showDay = DateTool.getAddDayFromDateToDate(today, showDate, '-');
      if (showDay > 0) {
        return '预购';
      } else {
        return '购票';
      }
    } else {
      return '购票';
    }
  }

  static maoyanAddPlatform(array) {
    if (array) {
      array.forEach(function (item) {
        if (item === 'maoyan') {
          array = array.concat(['meituan', 'dazhong']);
        }
      })
      return array;
    } else {
      return [];
    }
  }
}

export default TypeTool;
